
import { getUserSession } from 'services/EnterpriseCertificationListService'
export default {
  namespace: 'ImpressionLibraryModel',
  state: {
    userWsid: ''
  },
  effects: {
    *getUserWsid({ payload, callback }, { call, put }) {
      let res = yield call(getUserSession, payload)
      let { code } = res
      let reg = new RegExp(/0000$/, 'i')
      //如果请求成功
      if (reg.test(code)) {
        let { session: { userWsid } } = res
        yield callback('success', userWsid)
      } else {
        yield callback('error')
      }
    }
  },
  reducers: {
    setData(state, { payload }) {
      return {
        ...state,
        list: payload,
      }
    }
  },

};
